<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Bakalarka: Zdrojový soubor src/lexical.h</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generováno programem Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Hlavní&nbsp;stránka</span></a></li>
      <li><a href="annotated.html"><span>Třídy</span></a></li>
      <li class="current"><a href="files.html"><span>Soubory</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Seznam&nbsp;souborů</span></a></li>
    </ul>
  </div>
<h1>src/lexical.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> *      This program is free software; you can redistribute it and/or modify</span>
<a name="l00003"></a>00003 <span class="comment"> *      it under the terms of the GNU General Public License as published by</span>
<a name="l00004"></a>00004 <span class="comment"> *      the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00005"></a>00005 <span class="comment"> *      (at your option) any later version.</span>
<a name="l00006"></a>00006 <span class="comment"> *      </span>
<a name="l00007"></a>00007 <span class="comment"> *      This program is distributed in the hope that it will be useful,</span>
<a name="l00008"></a>00008 <span class="comment"> *      but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00009"></a>00009 <span class="comment"> *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00010"></a>00010 <span class="comment"> *      GNU General Public License for more details.</span>
<a name="l00011"></a>00011 <span class="comment"> *      </span>
<a name="l00012"></a>00012 <span class="comment"> *      You should have received a copy of the GNU General Public License</span>
<a name="l00013"></a>00013 <span class="comment"> *      along with this program; if not, write to the Free Software</span>
<a name="l00014"></a>00014 <span class="comment"> *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,</span>
<a name="l00015"></a>00015 <span class="comment"> *      MA 02110-1301, USA.</span>
<a name="l00016"></a>00016 <span class="comment"> */</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="preprocessor">#ifndef _LEXICAL_H</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define _LEXICAL_H</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;cctype&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;sstream&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;cstring&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;exception&gt;</span>
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <span class="preprocessor">#include "reader.h"</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="preprocessor">#define CHARACTER_CR '\r'</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define CHARACTER_LF '\n'</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00033"></a>00033 <span class="preprocessor">#define RESERVE_OBJECT "OBJECT"</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#define RESERVE_OBJECT_LEN 6 </span>
<a name="l00035"></a>00035 <span class="preprocessor"></span>
<a name="l00037"></a>00037 
<a name="l00041"></a><a class="code" href="classlexical.html">00041</a> <span class="keyword">class </span><a class="code" href="classlexical.html" title="Lexikální analýza.">lexical</a>{
<a name="l00042"></a>00042 
<a name="l00043"></a>00043         <span class="keyword">public</span>:
<a name="l00045"></a>00045 
<a name="l00049"></a><a class="code" href="classlexical_1_1invalidToken.html">00049</a>                 <span class="keyword">class </span><a class="code" href="classlexical_1_1invalidToken.html" title="Vyjímka neplatného tokenu.">invalidToken</a>: <span class="keyword">public</span> std::exception{
<a name="l00050"></a>00050                         
<a name="l00051"></a>00051                         <span class="keyword">private</span>:
<a name="l00052"></a>00052                                 <span class="keywordtype">unsigned</span> line;
<a name="l00053"></a>00053                         
<a name="l00054"></a>00054                         <span class="keyword">public</span>:
<a name="l00055"></a>00055                                 <a class="code" href="classlexical_1_1invalidToken.html" title="Vyjímka neplatného tokenu.">invalidToken</a>(<span class="keywordtype">unsigned</span>) <span class="keywordflow">throw</span>();
<a name="l00056"></a>00056                                 <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *what() <span class="keyword">const</span> <span class="keywordflow">throw</span>();
<a name="l00058"></a>00058 
<a name="l00062"></a>00062                                 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <a class="code" href="classlexical_1_1invalidToken.html#55b35313713b1df43a64ed2156e1ecc3" title="Vrací řádek neplatného znaku.">getLine</a>() <span class="keyword">const</span>;
<a name="l00063"></a>00063                         
<a name="l00064"></a>00064                 };
<a name="l00065"></a>00065                 
<a name="l00067"></a>00067 
<a name="l00072"></a><a class="code" href="classlexical_1_1token.html">00072</a>                 <span class="keyword">class </span><a class="code" href="classlexical_1_1token.html" title="Výstupní jednotka analyzátoru.">token</a>{
<a name="l00073"></a>00073                         
<a name="l00075"></a>00075 
<a name="l00080"></a>00080                         <span class="keyword">public</span>:
<a name="l00081"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df">00081</a>                                 <span class="keyword">enum</span> <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df" title="Výčet všech symbolů.">symbols</a>{
<a name="l00083"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df1fe3f8d2a499994cdf8a49ae90ebedb2">00083</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df1fe3f8d2a499994cdf8a49ae90ebedb2" title="Interpolace a jiné funkce.">GO_G</a>, 
<a name="l00085"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df7f23518f9eb7e4699f1d2d5028d386e9">00085</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df7f23518f9eb7e4699f1d2d5028d386e9" title="Rychlost posuvu.">FEED_F</a>, 
<a name="l00087"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df9dbb48df1056a726ded13c87ac99000d">00087</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df9dbb48df1056a726ded13c87ac99000d" title="Rychlost otáčení vřetena.">SPINDLE_S</a>, 
<a name="l00089"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df30e372aeb6b679d38117a6937a536d8f">00089</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df30e372aeb6b679d38117a6937a536d8f" title="Číslo řádky.">LINE_N</a>, 
<a name="l00091"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df568247de5d0908d14b9273913f012d19">00091</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df568247de5d0908d14b9273913f012d19" title="Funkce definované strojem.">MACHINE_M</a>, 
<a name="l00093"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df1ff0e3fc59c77d4ffdf13c4d1bb81021">00093</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df1ff0e3fc59c77d4ffdf13c4d1bb81021" title="Parametr kruhové interpolace.">RADIUS_R</a>, 
<a name="l00095"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df702a4094bc66f5c02e6eb4bdcd0501e4">00095</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df702a4094bc66f5c02e6eb4bdcd0501e4" title="Parametr interpolace, osa x.">AXIS_X</a>,
<a name="l00097"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176dfcaf4af6a636d7259184080870947e6a4">00097</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176dfcaf4af6a636d7259184080870947e6a4" title="Parametr interpolace, osa y.">AXIS_Y</a>,
<a name="l00099"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df7e79cf914dd46d306a60a897b1a1d435">00099</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df7e79cf914dd46d306a60a897b1a1d435" title="Parametr interpolace, osa z.">AXIS_Z</a>,
<a name="l00101"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176dfdb128e90312ecc24904e6029b2478f11">00101</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176dfdb128e90312ecc24904e6029b2478f11" title="Parametr kruhové interpolace, střed, osa x.">ARC_I</a>,
<a name="l00103"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df53354e76812c974f24a0cddf3bbb053e">00103</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df53354e76812c974f24a0cddf3bbb053e" title="Parametr kruhové interpolace, střed, osa y.">ARC_J</a>,
<a name="l00105"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176dface5dba98d590e64b5aff9ca40a9222f">00105</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176dface5dba98d590e64b5aff9ca40a9222f" title="Parametr kruhové interpolace, střed, osa z.">ARC_K</a>,
<a name="l00107"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df42b8693ddad73007833359cbc8ef1f6a">00107</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df42b8693ddad73007833359cbc8ef1f6a" title="Běžný kometář.">COMMENT</a>,
<a name="l00109"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176dfd2e2395a326aebb31fb928c38b77237a">00109</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176dfd2e2395a326aebb31fb928c38b77237a" title="Komentář s označením začátku bloku.">OBJECT_START</a>,
<a name="l00111"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df3e574e7c971311a8b6a6da3ff6474792">00111</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df3e574e7c971311a8b6a6da3ff6474792" title="Komentář s označením konce bloku.">OBJECT_END</a>,
<a name="l00113"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df6c8114f969f818e3b7c16ae12895eebc">00113</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df6c8114f969f818e3b7c16ae12895eebc" title="Změna nástroje.">TOOL_T</a>,
<a name="l00115"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df0675491338929ceb712e6f8a852f5dd2">00115</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df0675491338929ceb712e6f8a852f5dd2" title="Označení podprogramu.">SUBROUTINE_O</a>,
<a name="l00117"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df5c08e28bb0311dc30e3778723659bfb0">00117</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df5c08e28bb0311dc30e3778723659bfb0" title="Volání podprogramu.">CALL_P</a>,
<a name="l00119"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df2722b87907e89c0d9d217a960af393f6">00119</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df2722b87907e89c0d9d217a960af393f6" title="Konec souboru.">END</a>,
<a name="l00121"></a><a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df01117c456d6bdf21f8e3cbef2162c0d1">00121</a>                                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df01117c456d6bdf21f8e3cbef2162c0d1" title="Nastala chyba, neplatný token.">ERROR</a>
<a name="l00122"></a>00122                                                 };
<a name="l00123"></a>00123                                                 
<a name="l00124"></a>00124                                 <a class="code" href="classlexical_1_1token.html#72fac20575d593354489722a726176df" title="Výčet všech symbolů.">symbols</a> symbol;
<a name="l00126"></a>00126 
<a name="l00130"></a><a class="code" href="classlexical_1_1token.html#08905637b113c636a7a210654ae0465f">00130</a>                                 std::string <a class="code" href="classlexical_1_1token.html#08905637b113c636a7a210654ae0465f" title="Lexem.">lexem</a>;
<a name="l00132"></a>00132 
<a name="l00136"></a><a class="code" href="classlexical_1_1token.html#4efe257cce5634bdcbc8d799b2e42419">00136</a>                                 <span class="keywordtype">unsigned</span> <a class="code" href="classlexical_1_1token.html#4efe257cce5634bdcbc8d799b2e42419" title="Řádek tokenu.">line</a>;
<a name="l00137"></a>00137                                 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> startOffset, endOffset;
<a name="l00138"></a>00138                 };
<a name="l00139"></a>00139 
<a name="l00140"></a>00140         <span class="keyword">private</span>:
<a name="l00141"></a>00141         
<a name="l00143"></a>00143 
<a name="l00146"></a>00146                 <a class="code" href="classreader.html" title="Rozhraní před lexikální analýzou.">reader</a> *fileReader;
<a name="l00148"></a>00148                 <span class="keywordtype">unsigned</span> line;
<a name="l00149"></a>00149                 
<a name="l00151"></a>00151 
<a name="l00156"></a>00156                 std::string &amp;getString(std::string &amp;, <span class="keywordtype">unsigned</span>);
<a name="l00158"></a>00158 
<a name="l00161"></a>00161                 <span class="keywordtype">bool</span> compare(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">unsigned</span>);
<a name="l00163"></a>00163 
<a name="l00166"></a>00166                 <span class="keywordtype">int</span> getCharacter() throw(std::ifstream::failure);
<a name="l00168"></a>00168 
<a name="l00172"></a>00172                 <span class="keywordtype">void</span> characterBack() throw(<a class="code" href="classreader.html" title="Rozhraní před lexikální analýzou.">reader</a>::bufferOverflow);
<a name="l00174"></a>00174 
<a name="l00182"></a>00182                 <a class="code" href="classlexical_1_1token.html" title="Výstupní jednotka analyzátoru.">token</a> &amp;getName(<a class="code" href="classlexical_1_1token.html" title="Výstupní jednotka analyzátoru.">token</a> &amp;) throw(<a class="code" href="classreader.html" title="Rozhraní před lexikální analýzou.">reader</a>::bufferOverflow, std::ifstream::failure);
<a name="l00184"></a>00184 
<a name="l00191"></a>00191                 <a class="code" href="classlexical_1_1token.html" title="Výstupní jednotka analyzátoru.">token</a> &amp;getRealNumber(<a class="code" href="classlexical_1_1token.html" title="Výstupní jednotka analyzátoru.">token</a> &amp;) throw(<a class="code" href="classreader.html" title="Rozhraní před lexikální analýzou.">reader</a>::bufferOverflow, std::ifstream::failure);
<a name="l00193"></a>00193 
<a name="l00199"></a>00199                 <a class="code" href="classlexical_1_1token.html" title="Výstupní jednotka analyzátoru.">token</a> &amp;getIntegerNumber(<a class="code" href="classlexical_1_1token.html" title="Výstupní jednotka analyzátoru.">token</a> &amp;) throw(<a class="code" href="classreader.html" title="Rozhraní před lexikální analýzou.">reader</a>::bufferOverflow, std::ifstream::failure);
<a name="l00201"></a>00201 
<a name="l00211"></a>00211                 <a class="code" href="classlexical_1_1token.html" title="Výstupní jednotka analyzátoru.">token</a> &amp;parseComment(<a class="code" href="classlexical_1_1token.html" title="Výstupní jednotka analyzátoru.">token</a> &amp;) throw(<a class="code" href="classreader.html" title="Rozhraní před lexikální analýzou.">reader</a>::bufferOverflow, std::ifstream::failure);
<a name="l00213"></a>00213 
<a name="l00216"></a>00216                 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> getLength() const;
<a name="l00217"></a>00217                 
<a name="l00218"></a>00218         public:
<a name="l00220"></a>00220 
<a name="l00223"></a>00223                 <a class="code" href="classlexical.html" title="Lexikální analýza.">lexical</a>(<a class="code" href="classreader.html" title="Rozhraní před lexikální analýzou.">reader</a> *);
<a name="l00224"></a>00224                 
<a name="l00226"></a>00226 
<a name="l00234"></a>00234                 <a class="code" href="classlexical_1_1token.html" title="Výstupní jednotka analyzátoru.">token</a> &amp;<a class="code" href="classlexical.html#85376452fab03bc82895f2a0d6ec11f8" title="Vrací token.">getToken</a>(<a class="code" href="classlexical_1_1token.html" title="Výstupní jednotka analyzátoru.">token</a> &amp;) throw(<a class="code" href="classlexical_1_1invalidToken.html" title="Vyjímka neplatného tokenu.">invalidToken</a>, reader::bufferOverflow, std::ifstream::failure);
<a name="l00235"></a>00235         
<a name="l00236"></a>00236 };
<a name="l00237"></a>00237 
<a name="l00238"></a>00238 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generováno Tue Mar 2 10:34:16 2010 pro projekt Bakalarka programem&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>
